import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';

import '../../router/route_names.dart';

class FirstPage extends StatefulWidget {
  final String? title;

  const FirstPage({super.key, required this.title});

  @override
  State<FirstPage> createState() => _FirstPageState();
}

class _FirstPageState extends State<FirstPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text(widget.title ?? "First")),
      body: Center(
        child: TextButton(
          onPressed: () {
            context.go(RouteNames.second);
          },
          child: Text("跳转到第二页", style: TextStyle(fontSize: 20)),
        ),
      ),
    );
  }
}
